<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/12 0012
 * Time: 下午 3:55
 */

namespace ServiceClass;


use ServiceClassInterface\MessageContract;
use Illuminate\Support\Facades\DB;
use ToolClass\PageClass;

class Message implements MessageContract
{
    public function addMessage($messageData)
    {
        $messageData['message_CreateTime'] = date('Y-m-d');
        $result = DB::table('message')->insert($messageData);
        if($result){

            return 1;
        }else{

            return 0;
        }

    }

    public function deleteMessage($messageData)
    {

        $result = DB::table('message')->where('message_id',$messageData)->delete();
        if($result){
            return 1;
        }else{
            return 0;
        }
    }

    public function searchMessage($messageData)
    {

        $result = DB::table('message')->where('message_id',$messageData)->get();
        if($result){
            return $result;
        }else{
            return 0;
        }

    }
    public function selectMessageList($table,$limit,$where,$page)
    {

        $result = PageClass::Page($table,$limit,$where,$page);

        return $result;

    }

}